<?php
session_start();
header('Content-Type:text/html;charset=utf-8');
require_once($_SERVER['DOCUMENT_ROOT'].'/public/func.php');
$config=require_once($_SERVER['DOCUMENT_ROOT'].'/public/config.php');
$account=$_POST['account'];
$pwd=$_POST['pwd'];
$yzm=$_POST['yzm'];
$cyzm=$_COOKIE['yzm'];
$accarr=selects($config,'vip',"where `account`='$account'");
$arr=selects($config,'vip',"where `account`='$account'&&`pwd`='$pwd'");
if(!strcasecmp($yzm,$cyzm)=='0'){
   //var_dump(strcasecmp($yzm,$cyzm));die;
    echo  "<script>alert('验证码输入错误');window.location.href='/home/landing/index.php'</script>";
}else{
    setcookie('yzm','');
}
if(!$accarr){
    echo  "<script>alert('该账号不存在');window.location.href='/home/landing/index.php'</script>";
}elseif(!$arr){
    echo  "<script>alert('密码输入错误');window.location.href='/home/landing/index.php'</script>";
}else{
     $_SESSION['vip']['account']=$account;
     echo  "<script>alert('登陆成功');window.location.href='/home/index.php'</script>";
}
?>